package com.showtao.front.dto;

import java.io.Serializable;
import java.util.Date;

import com.showtao.front.domain.VehicleLine;

@SuppressWarnings("serial")
public class VehicleLineDto implements Serializable {

	private Long id;
	private Long brandId;
	private String brandName;
	private String name;
	private Date createdAt;
	private Date updatedAt;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getBrandId() {
		return brandId;
	}

	public void setBrandId(Long brandId) {
		this.brandId = brandId;
	}

	public String getBrandName() {
		return brandName;
	}

	public void setBrandName(String brandName) {
		this.brandName = brandName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public Date getUpdatedAt() {
		return updatedAt;
	}

	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}

	public static VehicleLineDto from(VehicleLine vl){
		VehicleLineDto dto = new VehicleLineDto();
		dto.setId(vl.getId());
		dto.setName(vl.getName());
		dto.setCreatedAt(dto.getCreatedAt());
		dto.setUpdatedAt(dto.getUpdatedAt());
		if(vl.getBrand()!=null){
			dto.setBrandId(vl.getBrand().getId());
			dto.setBrandName(vl.getBrand().getName());
		}
		return dto;
	}
}
